import numpy as np
import pandas as pd

# # 生成一个demo文件
# df2 = pd.DataFrame({
#     'name': ['Gsm', 'Tom', '杰克'],
#     'age': [40, 50, 60]
# })
#
# df2.to_excel('out.xlsx', index=None)


# # 读取Excel文件方式一
# sheet01 = pd.read_excel('out.xlsx')  # 不指定sheet_name，默认读取第一个Sheet
# print(sheet01)


# # 读取Excel文件方式二
# data = {}
# with pd.ExcelFile('out.xlsx') as xls:
#     data['Sheet1'] = pd.read_excel(xls, sheet_name='Sheet1')
#     data['Sheet2'] = pd.read_excel(xls, sheet_name='Sheet2')
# print(data)


# # 读取Excel文件方式二 文件流
# file = open('out.xlsx', 'rb')
# data = {}
# with pd.ExcelFile(file) as xls:
#     data['Sheet1'] = pd.read_excel(xls, 'Sheet1')
#     data['Sheet2'] = pd.read_excel(xls, 'Sheet2')
# print(data)


# sheet01 = pd.read_excel('out.xlsx', sheet_name='Sheet1', usecols=['name'])
# print(sheet01)


# sheet01 = pd.read_excel('out.xlsx', sheet_name='Sheet1', index_col='name', usecols=['name', 'age'])
# print(sheet01)

sheet01 = pd.read_excel('out.xlsx', header=None, skiprows=1)
print(sheet01)



